package cn.mulanbay.schedule.mapper;

import cn.mulanbay.schedule.domain.TaskTrigger;
import cn.mulanbay.schedule.enums.TriggerStatus;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 * @author fenghong
 * @create 2022-01-16 10:00
 */
public interface TaskTriggerMapper extends BaseMapper<TaskTrigger> {

    /**
     * 更新调度状态
     * @param triggerId
     * @param status
     * @return
     */
    int updateTaskTriggerStatus(@Param("triggerId")Long triggerId,@Param("status") TriggerStatus status);

    /**
     * 获取有效的触发器列表
     * @param deployId
     * @param supportDistri
     * @return
     */
    List<TaskTrigger> getActiveTaskTrigger(@Param("deployId")String deployId,@Param("supportDistri") boolean supportDistri);

    /**
     * 获取分类列表，统计聚合
     * @param wrapper
     * @param groupField
     * @return
     */
    List<String> getCategoryList(@Param(Constants.WRAPPER) Wrapper wrapper,@Param("groupField") String groupField);
}
